﻿using System;
using System.Configuration;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPIS.DBM;
using KPIS.GERP.GIMS.MODEL;

namespace KPIS.GERP.GIMS.DAL
{
    public sealed class PurchaseOrderItemDAL
    {
        IDBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);

        public PurchaseOrderItemDAL()
        {
        }

        public void Insert(int BidderSeq, int PoSeq, IDBManager dbManagerTrans)
        {
            string strSQL;
            try
            {
                dbManagerTrans.CreateParameters(2);

                dbManagerTrans.AddParameters(0, "@icm_po_seq", PoSeq);
                dbManagerTrans.AddParameters(1, "@icm_bidder_seq", BidderSeq);

                strSQL = "INSERT INTO icm_purchase_order_item (icm_po_seq,icm_bidder_quo_seq)" +
                        " SELECT @icm_po_seq,icm_bidder_quo_seq FROM icm_bidder_quotation WHERE icm_bidder_seq = @icm_bidder_seq";

                dbManagerTrans.ExecuteNonQuery(CommandType.Text, strSQL);

            }
            catch
            {
                throw;
            }
        }
    }
}
